+testexecdir = join_paths(installed_test_bindir, 'tools')
+testdatadir = join_paths(installed_test_datadir, 'tools')
+
bash = find_program('bash', required : false)
if bash.found()
test_env = environment()
test_env.set('GTK_QUERY_SETTINGS', get_variable('gtk4_query_settings').full_path())
foreach t : ['simplify', 'settings']
- configure_file(output : 'test-@0@'.format(t),
- input : 'test-@0@.in'.format(t),
- configuration : configuration_data())
-
+ configure_file(output: t,
+ input: '@0@.in'.format(t),
+ configuration: configuration_data(),
+ install: get_option('install-tests'),
+ install_dir: testexecdir)
test(t, bash,
- args : 'test-@0@'.format(t),
- workdir : meson.current_build_dir(),
- env : test_env,
- suite: 'tools')
+ args: 'test-@0@'.format(t),
+ workdir: meson.current_build_dir(),
+ env: test_env,
+ suite: 'tools')
endforeach
-endif # bash found
+endif
-# Installed data
+if get_option('install-tests')
+ foreach t : ['simplify', 'settings']
+ test_conf = configuration_data()
+ test_conf.set('testexecdir', testexecdir)
+ test_conf.set('test', t)
+ configure_file(output: '@0@.test'.format(t),
+ input: 'tools.test.in',
+ configuration: test_conf,
+ install: true,
+ install_dir: testdatadir)
+ endforeach
-test_simplify_data = [
- 'simplify/test1.ui', 'simplify/test1.expected',
- 'simplify/test2.ui', 'simplify/test2.expected',
- 'simplify/test3.ui', 'simplify/test3.expected',
- 'simplify/test4.ui', 'simplify/test4.expected',
- 'simplify/test5.ui', 'simplify/test5.expected',
- 'simplify/test6.ui', 'simplify/test6.expected',
- 'simplify/test7.ui', 'simplify/test7.expected',
- 'simplify/test8.ui', 'simplify/test8.expected',
-]
-# TODO: install in case of installed tests - install_data()
+ install_subdir('simplify-data', install_dir: testexecdir)
+endif
--- /dev/null
+#! /bin/bash
+
+GTK_QUERY_SETTINGS=${GTK_QUERY_SETTINGS:-gtk-query-settings}
+TEST_RESULT_DIR=${TEST_RESULT_DIR:-/tmp}
+
+shopt -s nullglob
+
+echo "1..1"
+
+name=gtk-query-settings
+result=$TEST_RESULT_DIR/$name.out
+$GTK_QUERY_SETTINGS 2>/dev/null >$result
+if [ $(wc -l $result | cut -f1 -d' ') -eq 882 ]; then
+ echo "ok 1 $name"
+else
+ echo "not ok 1 $name"
+fi
--- /dev/null
+<!-- default property gets stripped -->
+<interface>
+ <object class="GtkWindow">
+ </object>
+</interface>
--- /dev/null
+<!-- default property gets stripped -->
+<interface>
+ <object class="GtkWindow">
+ <property name="visible">False</property>
+ </object>
+</interface>
--- /dev/null
+<!-- non-default property not stripped -->
+<interface>
+ <object class="GtkWindow">
+ <property name="visible">1</property>
+ </object>
+</interface>
--- /dev/null
+<!-- non-default property not stripped -->
+<interface>
+ <object class="GtkWindow">
+ <property name="visible">True</property>
+ </object>
+</interface>
--- /dev/null
+<!-- translatable property not stripped -->
+<interface>
+ <object class="GtkWindow">
+ <property name="visible" translatable="yes">0</property>
+ </object>
+</interface>
--- /dev/null
+<!-- translatable property not stripped -->
+<interface>
+ <object class="GtkWindow">
+ <property name="visible" translatable="yes">False</property>
+ </object>
+</interface>
--- /dev/null
+<!-- irrelevant comments and context are stripped -->
+<interface>
+ <object class="GtkWindow">
+ <property name="visible">1</property>
+ </object>
+</interface>
--- /dev/null
+<!-- irrelevant comments and context are stripped -->
+<interface>
+ <object class="GtkWindow">
+ <property name="visible" comments="foo" context="bla">True</property>
+ </object>
+</interface>
--- /dev/null
+<!-- placeholders are stripped -->
+<interface>
+ <object class="GtkWindow">
+ <child>
+ <object class="GtkBox">
+ </object>
+ </child>
+ </object>
+</interface>
--- /dev/null
+<!-- placeholders are stripped -->
+<interface>
+ <object class="GtkWindow">
+ <child>
+ <object class="GtkBox">
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ </child>
+ </object>
+</interface>
--- /dev/null
+<!-- non-canonical property name works -->
+<interface>
+ <object class="GtkWindow">
+ </object>
+</interface>
--- /dev/null
+<!-- non-canonical property name works -->
+<interface>
+ <object class="GtkWindow">
+ <property name="default_width">-1</property>
+ </object>
+</interface>
--- /dev/null
+<!-- default child property gets stripped -->
+<interface>
+ <object class="GtkBox">
+ <child>
+ <object class="GtkLabel"/>
+ </child>
+ </object>
+</interface>
--- /dev/null
+<!-- default child property gets stripped -->
+<interface>
+ <object class="GtkBox">
+ <child>
+ <object class="GtkLabel">
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ </packing>
+ </child>
+ </object>
+</interface>
--- /dev/null
+<!-- non-default child property remains -->
+<interface>
+ <object class="GtkBox">
+ <child>
+ <object class="GtkLabel"/>
+ <packing>
+ <property name="expand">1</property>
+ </packing>
+ </child>
+ </object>
+</interface>
--- /dev/null
+<!-- non-default child property remains -->
+<interface>
+ <object class="GtkBox">
+ <child>
+ <object class="GtkLabel">
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ </packing>
+ </child>
+ </object>
+</interface>
--- /dev/null
+#! /bin/bash
+
+GTK_BUILDER_TOOL=${GTK_BUILDER_TOOL:-gtk-builder-tool}
+TEST_DATA_DIR=${TEST_DATA_DIR:-./simplify-data}
+TEST_RESULT_DIR=${TEST_RESULT_DIR:-/tmp}
+
+shopt -s nullglob
+TESTS=( "$TEST_DATA_DIR"/*.ui )
+
+echo "1..${#TESTS}"
+
+I=1
+for t in ${TESTS[*]}; do
+ name=$(basename $t .ui)
+ expected="$TEST_DATA_DIR/$name.expected"
+ result="$TEST_RESULT_DIR/$name.out"
+ diff="$TEST_RESULT_DIR/$name.diff"
+ ref="$TEST_RESULT_DIR/$name.ref"
+
+ $GTK_BUILDER_TOOL simplify $t 2>/dev/null >$result
+
+ if diff -u "$expected" "$result" > "$diff"; then
+ echo "ok $I $name"
+ rm "$diff"
+ else
+ echo "not ok $I $name"
+ cp "$expected" "$ref"
+ fi
+
+ I=$((I+1))
+done
+++ /dev/null
-<!-- default property gets stripped -->
-<interface>
- <object class="GtkWindow">
- </object>
-</interface>
+++ /dev/null
-<!-- default property gets stripped -->
-<interface>
- <object class="GtkWindow">
- <property name="visible">False</property>
- </object>
-</interface>
+++ /dev/null
-<!-- non-default property not stripped -->
-<interface>
- <object class="GtkWindow">
- <property name="visible">True</property>
- </object>
-</interface>
+++ /dev/null
-<!-- non-default property not stripped -->
-<interface>
- <object class="GtkWindow">
- <property name="visible">True</property>
- </object>
-</interface>
+++ /dev/null
-<!-- translatable property not stripped -->
-<interface>
- <object class="GtkWindow">
- <property name="visible" translatable="yes">False</property>
- </object>
-</interface>
+++ /dev/null
-<!-- translatable property not stripped -->
-<interface>
- <object class="GtkWindow">
- <property name="visible" translatable="yes">False</property>
- </object>
-</interface>
+++ /dev/null
-<!-- irrelevant comments and context are stripped -->
-<interface>
- <object class="GtkWindow">
- <property name="visible">True</property>
- </object>
-</interface>
+++ /dev/null
-<!-- irrelevant comments and context are stripped -->
-<interface>
- <object class="GtkWindow">
- <property name="visible" comments="foo" context="bla">True</property>
- </object>
-</interface>
+++ /dev/null
-<!-- placeholders are stripped -->
-<interface>
- <object class="GtkWindow">
- <child>
- <object class="GtkBox">
- </object>
- </child>
- </object>
-</interface>
+++ /dev/null
-<!-- placeholders are stripped -->
-<interface>
- <object class="GtkWindow">
- <child>
- <object class="GtkBox">
- <child>
- <placeholder/>
- </child>
- </object>
- </child>
- </object>
-</interface>
+++ /dev/null
-<!-- non-canonical property name works -->
-<interface>
- <object class="GtkWindow">
- </object>
-</interface>
+++ /dev/null
-<!-- non-canonical property name works -->
-<interface>
- <object class="GtkWindow">
- <property name="default_width">-1</property>
- </object>
-</interface>
+++ /dev/null
-<!-- default child property gets stripped -->
-<interface>
- <object class="GtkBox">
- <child>
- <object class="GtkLabel"/>
- </child>
- </object>
-</interface>
+++ /dev/null
-<!-- default child property gets stripped -->
-<interface>
- <object class="GtkBox">
- <child>
- <object class="GtkLabel">
- </object>
- <packing>
- <property name="expand">False</property>
- </packing>
- </child>
- </object>
-</interface>
+++ /dev/null
-<!-- non-default child property remains -->
-<interface>
- <object class="GtkBox">
- <child>
- <object class="GtkLabel"/>
- <packing>
- <property name="expand">True</property>
- </packing>
- </child>
- </object>
-</interface>
+++ /dev/null
-<!-- non-default child property remains -->
-<interface>
- <object class="GtkBox">
- <child>
- <object class="GtkLabel">
- </object>
- <packing>
- <property name="expand">True</property>
- </packing>
- </child>
- </object>
-</interface>
+++ /dev/null
-#! /bin/bash
-
-GTK_QUERY_SETTINGS=${GTK_QUERY_SETTINGS:-gtk-query-settings}
-TEST_RESULT_DIR=${TEST_RESULT_DIR:-/tmp}
-
-shopt -s nullglob
-
-echo "1..1"
-
-name=gtk-query-settings
-result=$TEST_RESULT_DIR/$name.out
-$GTK_QUERY_SETTINGS 2>/dev/null >$result
-if [ $(wc -l $result | cut -f1 -d' ') -eq 882 ]; then
- echo "ok 1 $name"
-else
- echo "not ok 1 $name"
-fi
+++ /dev/null
-#! /bin/bash
-
-GTK_BUILDER_TOOL=${GTK_BUILDER_TOOL:-gtk-builder-tool}
-TEST_DATA_DIR=${TEST_DATA_DIR:-./simplify}
-TEST_RESULT_DIR=${TEST_RESULT_DIR:-/tmp}
-
-shopt -s nullglob
-TESTS=( "$TEST_DATA_DIR"/*.ui )
-
-echo "1..${#TESTS}"
-
-I=1
-for t in ${TESTS[*]}; do
- name=$(basename $t .ui)
- expected="$TEST_DATA_DIR/$name.expected"
- result="$TEST_RESULT_DIR/$name.out"
-
- $GTK_BUILDER_TOOL simplify $t 2>/dev/null >$result
-
- if diff "$expected" "$result" > /dev/null; then
- echo "ok $I $name"
- else
- echo "not ok $I $name"
- fi
-
- I=$((I+1))
-done
--- /dev/null
+[Test]
+Exec=/bin/sh -c "env G_ENABLE_DIAGNOSTIC=0 TEST_DATA_DIR=@testexecdir@/@test@-data @testexecdir@/@test@"
+Type=session
+Output=TAP